import React from 'react';
import { View, Text, Button, StatusBar, NativeModules } from 'react-native';

var nativeModule = NativeModules.OpenNativeModule;

export default class HomeScreen extends React.Component {
  static navigationOptions = {
    headerTitle: 'RN 和 Native混合编程'
  };
  constructor() {
    super();
    StatusBar.setBarStyle('light-content');
    this.state = {
      isNavBarHidden: false
    }
  }

  render() {
    return (
      <View>
        <Text>首页</Text>
        <Button title={'跳转到详情页'} onPress={() => {
          this.props.navigation.navigate('Detail');
        }} />
        <Button title={'跳转到原生页面'} onPress={() => {
          this.jumpToNativeView();
        }} />
      </View>
    )
  }

  jumpToNativeView() {
    nativeModule.openNativeVC();
  }
}